/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023.
 * Description: hkids tracepoint functions.
 * Author: weiyuchen
 * Create: 2023-09-15
 */

#include <linux/sched.h>
#include <linux/hkids/hkids.h>

#ifdef CONFIG_HKIDS_CHK_MLTDOWN
DEFINE_TRACE(hkids_chkmdatt,
	     TP_PROTO(struct task_struct *task,
		       unsigned long addr, int code),
	     TP_ARGS(task, addr, code));
EXPORT_TRACEPOINT_SYMBOL(hkids_chkmdatt);
#endif

#ifdef CONFIG_HKIDS_CHK_HEAP_SPRAY
DEFINE_TRACE(hkids_chkhpspy,
	     TP_PROTO(unsigned int count),
	     TP_ARGS(count));
EXPORT_TRACEPOINT_SYMBOL(hkids_chkhpspy);
#endif

#ifdef CONFIG_HKIDS_CHK_PRIV_ESCAPE
DEFINE_TRACE(hkids_chkprivesc,
	     TP_PROTO(const struct cred *old_cred, const struct cred *new_cred),
	     TP_ARGS(old_cred, new_cred));
EXPORT_TRACEPOINT_SYMBOL(hkids_chkprivesc);
#endif

#ifdef CONFIG_HKIDS_CHK_ABNORMAL_EXIT
DEFINE_TRACE(hkids_chkabexit,
	     TP_PROTO(int sig, struct task_struct *sender,
		       struct task_struct *receiver),
	     TP_ARGS(sig, sender, receiver));
EXPORT_TRACEPOINT_SYMBOL(hkids_chkabexit);
#endif

#ifdef CONFIG_HKIDS_CHK_INJECTION
DEFINE_TRACE(hkids_chkabptratt,
	     TP_PROTO(struct task_struct *tracer, struct task_struct *tracee),
	     TP_ARGS(tracer, tracee));
EXPORT_TRACEPOINT_SYMBOL(hkids_chkabptratt);

DEFINE_TRACE(hkids_chkabmemfd,
	     TP_PROTO(struct task_struct *task),
	     TP_ARGS(task));
EXPORT_TRACEPOINT_SYMBOL(hkids_chkabmemfd);
#endif
